#!/bin/sh

# Determine the path to this application.
CURDIR="`pwd`"
APPDIR=`dirname "$0"`
cd "${APPDIR}"
APPDIR="`pwd`"
cd "${CURDIR}"

# Root check
[ ! "`whoami`" = "root" ] && exec gksu $0 "$@"

case $1 in
 -help)
 defaulthtmlviewer file://${APPDIR}/gpkg.html
 ;;
 -local)
 exec $APPDIR/functions -install-local
 ;;
 -preferences)
 exec $APPDIR/functions -prefs
 ;;
 -about)
 exec $APPDIR/functions -about
 ;;
 -help)
 exec $APPDIR/functions -help
 ;;
 *)
 if [ ! "$1" = "" ];then
  [ ! "`echo "$1" | grep .tbz`" = "" ] && exec $APPDIR/functions -install-pkg
 fi
 exec $APPDIR/gpkg
 ;;
esac
